<?php

namespace App\Models;

use App\Common\Constant\Params;
use Illuminate\Database\Eloquent\Model;

class MasterCash extends BaseModel
{
    protected $table = 'master_cash';

    const CREATED_AT = 'add_time';
    const UPDATED_AT = 'upd_time';

    protected $dateFormat = 'U';

    protected $fillable = [
        'order_number',
        'master_id',
        'amount',
        'alipay_name',
        'alipay_account',
        'last_balance',
        'status',
        'pay_time',
    ];

    protected $casts = [
        'amount' => 'double',
        'last_balance' => 'double',
        'pay_time'=>'datetime',
    ];

    /**
     * 状态文字
     * status_text
     */
    public function getStatusTextAttribute()
    {
        return Params::$MASTER_CASH[$this->status];
    }
}
